!(function () {
  "use strict";
  var e = {
      235: function (e, t, n) {
        t.Z = void 0;
        var o = n(115);
        function i(e) {
          return (
            (i =
              "function" == typeof Symbol && "symbol" == typeof Symbol.iterator
                ? function (e) {
                    return typeof e;
                  }
                : function (e) {
                    return e &&
                      "function" == typeof Symbol &&
                      e.constructor === Symbol &&
                      e !== Symbol.prototype
                      ? "symbol"
                      : typeof e;
                  }),
            i(e)
          );
        }
        function r(e, t) {
          for (var n = 0; n < t.length; n++) {
            var o = t[n];
            (o.enumerable = o.enumerable || !1),
              (o.configurable = !0),
              "value" in o && (o.writable = !0),
              Object.defineProperty(e, o.key, o);
          }
        }
        function a(e, t) {
          return (
            (a =
              Object.setPrototypeOf ||
              function (e, t) {
                return (e.__proto__ = t), e;
              }),
            a(e, t)
          );
        }
        function c(e) {
          return (
            (c = Object.setPrototypeOf
              ? Object.getPrototypeOf
              : function (e) {
                  return e.__proto__ || Object.getPrototypeOf(e);
                }),
            c(e)
          );
        }
        var s = (function (e) {
            !(function (e, t) {
              if ("function" != typeof t && null !== t)
                throw new TypeError(
                  "Super expression must either be null or a function"
                );
              (e.prototype = Object.create(t && t.prototype, {
                constructor: { value: e, writable: !0, configurable: !0 },
              })),
                t && a(e, t);
            })(u, e);
            var t,
              n,
              s,
              d,
              l =
                ((s = u),
                (d = (function () {
                  if ("undefined" == typeof Reflect || !Reflect.construct)
                    return !1;
                  if (Reflect.construct.sham) return !1;
                  if ("function" == typeof Proxy) return !0;
                  try {
                    return (
                      Date.prototype.toString.call(
                        Reflect.construct(Date, [], function () {})
                      ),
                      !0
                    );
                  } catch (e) {
                    return !1;
                  }
                })()),
                function () {
                  var e,
                    t,
                    n,
                    o = c(s);
                  if (d) {
                    var r = c(this).constructor;
                    e = Reflect.construct(o, arguments, r);
                  } else e = o.apply(this, arguments);
                  return (
                    (t = this),
                    !(n = e) || ("object" !== i(n) && "function" != typeof n)
                      ? (function (e) {
                          if (void 0 === e)
                            throw new ReferenceError(
                              "this hasn't been initialised - super() hasn't been called"
                            );
                          return e;
                        })(t)
                      : n
                  );
                });
            function u() {
              var e;
              !(function (e, t) {
                if (!(e instanceof t))
                  throw new TypeError("Cannot call a class as a function");
              })(this, u);
              for (
                var t = arguments.length, n = new Array(t), o = 0;
                o < t;
                o++
              )
                n[o] = arguments[o];
              return (
                ((e = l.call.apply(l, [this].concat(n))).drawioIframe = null),
                (e.isIframeVisible = !1),
                (e.closeHolding = !1),
                (e.initialized = !1),
                (e.drawioFrameLoaded = !1),
                (e.eventListenerBound = !1),
                (e.iframeInserted = !1),
                (e.drawioUrl = ""),
                (e.closeIframe = function () {
                  var t = new Event("drawioClosed");
                  window.dispatchEvent(t), e.hideIframe();
                }),
                (e.isOpen = function () {
                  return e.isIframeVisible;
                }),
                (e.isLoaded = function () {
                  return e.initialized;
                }),
                (e.editImage = function (t) {
                  return e.drawioFrameLoaded
                    ? t
                      ? 0 === t.indexOf("<svg")
                        ? (e.sendMsgToDrawio({ action: "load", xml: t }),
                          void e.showIframe())
                        : (e.showIframe(),
                          e.sendMsgToDrawio({
                            action: "spinner",
                            message: "åŠ è½½ä¸­...",
                            show: !0,
                            enabled: !1,
                          }),
                          void fetch(t)
                            .then(function (e) {
                              return e.text();
                            })
                            .then(function (t) {
                              e.sendMsgToDrawio({
                                action: "spinner",
                                message: "",
                                show: !1,
                                enabled: !0,
                              }),
                                setTimeout(function () {
                                  e.sendMsgToDrawio({ action: "load", xml: t });
                                }, 50);
                            })
                            .catch(function () {
                              e.sendMsgToDrawio({
                                action: "spinner",
                                message: "æµç¨‹å›¾åŠ è½½å¤±è´¥",
                                show: !0,
                                enabled: !1,
                              });
                            }))
                      : (e.sendMsgToDrawio({ action: "load" }),
                        void e.showIframe())
                    : Promise.reject();
                }),
                (e.init = function (t) {
                  return (
                    (e.editImage.close = e.closeIframe),
                    (e.editImage.isOpen = e.isOpen),
                    (e.editImage.isLoaded = e.isLoaded),
                    e.iframeInserted ||
                      ((e.iframeInserted = !0),
                      t || (t = "https://www.draw.io/"),
                      e.initCommunication(t)),
                    e.editImage
                  );
                }),
                e
              );
            }
            return (
              (t = u),
              (n = [
                {
                  key: "sendMsgToDrawio",
                  value: function (e) {
                    this.getFrame().contentWindow.postMessage(
                      JSON.stringify(e),
                      "*"
                    );
                  },
                },
                {
                  key: "showIframe",
                  value: function () {
                    this.getFrame().setAttribute("style", o.visibleStyle),
                      (this.isIframeVisible = !0);
                  },
                },
                {
                  key: "hideIframe",
                  value: function () {
                    var e = this;
                    this.getFrame().setAttribute("style", o.hiddenStyle),
                      (this.isIframeVisible = !1),
                      setTimeout(function () {
                        e.sendMsgToDrawio({ action: "load" });
                      }, 500),
                      setTimeout(function () {
                        e.sendMsgToDrawio({
                          action: "spinner",
                          message: "",
                          show: !1,
                          enabled: !0,
                        });
                      }, 300);
                  },
                },
                {
                  key: "getFrame",
                  value: function () {
                    return (
                      this.drawioIframe ||
                        ((this.drawioIframe = document.createElement("iframe")),
                        (this.drawioIframe.id = "drawio-iframe")),
                      this.drawioIframe
                    );
                  },
                },
                {
                  key: "initCommunication",
                  value: function (e) {
                    if (
                      ((this.drawioUrl = e),
                      (this.closeHolding = !!(0, o.getKey)(e, "hold")),
                      !this.initialized)
                    ) {
                      (this.initialized = !0),
                        -1 !== e.indexOf("?")
                          ? (e += "&".concat(o.queryStr))
                          : (e += "?".concat(o.queryStr));
                      var t = this.getFrame();
                      (t.src = e),
                        this.hideIframe(),
                        document.documentElement.appendChild(t),
                        this.bindEventListener();
                    }
                  },
                },
                {
                  key: "bindEventListener",
                  value: function () {
                    var e = this;
                    this.eventListenerBound ||
                      ((this.eventListenerBound = !0),
                      window.addEventListener("message", function (t) {
                        if (t.data) {
                          var n = null;
                          try {
                            n = JSON.parse(t.data);
                          } catch (e) {}
                          if (n && "object" === i(n))
                            switch (n.event) {
                              case "init":
                                (e.drawioFrameLoaded = !0),
                                  window.dispatchEvent(
                                    new Event("drawioLoaded")
                                  );
                                break;
                              case "save":
                                e.sendMsgToDrawio({
                                  action: "export",
                                  format: "png",
                                  spinKey: "saving",
                                }),
                                  e.setSavingFlag(),
                                  e.checkReady(function () {
                                    e.sendMsgToDrawio({
                                      action: "export",
                                      format: "svg",
                                      spinKey: "saving",
                                    });
                                  }),
                                  e.closeHolding
                                    ? e.sendMsgToDrawio({
                                        action: "spinner",
                                        message: "ä¿å­˜ä¸­...",
                                        show: !0,
                                        enabled: !1,
                                      })
                                    : e.hideIframe();
                                break;
                              case "export":
                                if (!n.data) return;
                                if (
                                  (e.clearSavingFlag(),
                                  -1 !== n.data.indexOf("data:image/png"))
                                ) {
                                  var r = new Event("drawioImageCreated");
                                  (r.imageType = "png"),
                                    (r.imageContent = n.data),
                                    window.dispatchEvent(r);
                                } else
                                  (0, o.processSvg)(
                                    n.xml,
                                    n.data,
                                    function (e) {
                                      var t = new Event("drawioImageCreated");
                                      (t.imageType = "svg"),
                                        (t.imageContent = e),
                                        (t.xml = n.xml),
                                        window.dispatchEvent(t);
                                    }
                                  );
                                break;
                              case "exit":
                                e.closeIframe();
                            }
                        }
                      }));
                  },
                },
              ]) && r(t.prototype, n),
              u
            );
          })(o.ItvCheck),
          d = new s().init;
        t.Z = d;
      },
      115: function (e, t) {
        function n(e, t) {
          for (var n = 0; n < t.length; n++) {
            var o = t[n];
            (o.enumerable = o.enumerable || !1),
              (o.configurable = !0),
              "value" in o && (o.writable = !0),
              Object.defineProperty(e, o.key, o);
          }
        }
        Object.defineProperty(t, "__esModule", { value: !0 }),
          (t.processSvg = function (e, t, n) {
            var o = (function (e) {
              var t = document.createElement("div");
              null != t.textContent ? (t.textContent = e) : (t.innerText = e);
              var n = t.innerHTML;
              return (t = null), n;
            })(e);
            (t = t.split(",")[1]), (t = atob(t));
            for (var i = new Uint8Array(t.length), r = 0; r < t.length; r++)
              i[r] = t.charCodeAt(r);
            var a = new Blob([i], { type: "image/svg+xml" }),
              c = new FileReader();
            c.readAsText(a),
              (c.onload = function () {
                var e = c.result;
                "function" == typeof n &&
                  n(e.replace("<svg ", "<svg content='".concat(o, "' ")));
              });
          }),
          (t.getKey = function (e, t) {
            return ((n = e.split("?")[1]),
            (o = {}),
            (n || "").replace(/([^?&=/]+)=([^?&=/]*)/g, function (e, t, n) {
              return (o[decodeURIComponent(t)] = decodeURIComponent(n));
            }),
            o)[t];
            var n, o;
          }),
          (t.ItvCheck = t.queryStr = t.hiddenStyle = t.visibleStyle = void 0),
          (t.visibleStyle =
            "position:fixed;height:100%;width:100%;top:0;left:0;z-index:99990;background:white;"),
          (t.hiddenStyle =
            "position:fixed;height:100%;width:100%;top:-10240px;left:0;z-index:99990;background:white;"),
          (t.queryStr = "embed=1&ui=atlas&spin=1&proto=json&lang=zh");
        var o = (function () {
          function e() {
            !(function (e, t) {
              if (!(e instanceof t))
                throw new TypeError("Cannot call a class as a function");
            })(this, e),
              (this.savingSto = null),
              (this.isSaving = !1);
          }
          var t, o;
          return (
            (t = e),
            (o = [
              {
                key: "setSavingFlag",
                value: function () {
                  var e = this;
                  this.clearSavingFlag(),
                    (this.isSaving = !0),
                    (this.savingSto = setTimeout(function () {
                      e.isSaving = !1;
                    }, 5e3));
                },
              },
              {
                key: "clearSavingFlag",
                value: function () {
                  (this.isSaving = !1), clearTimeout(this.savingSto);
                },
              },
              {
                key: "checkReady",
                value: function (e) {
                  var t = this,
                    n = 0,
                    o = setInterval(function () {
                      (++n > 100 || !t.isSaving) && (clearInterval(o), e());
                    }, 50);
                },
              },
            ]) && n(t.prototype, o),
            e
          );
        })();
        t.ItvCheck = o;
      },
    },
    t = {};
  function n(o) {
    var i = t[o];
    if (void 0 !== i) return i.exports;
    var r = (t[o] = { exports: {} });
    return e[o](r, r.exports, n), r.exports;
  }
  !(function () {
    var e = n(235);
    function t(e) {
      return (
        (t =
          "function" == typeof Symbol && "symbol" == typeof Symbol.iterator
            ? function (e) {
                return typeof e;
              }
            : function (e) {
                return e &&
                  "function" == typeof Symbol &&
                  e.constructor === Symbol &&
                  e !== Symbol.prototype
                  ? "symbol"
                  : typeof e;
              }),
        t(e)
      );
    }
    var o = function (e) {
        return "".concat("axhub-drawio", "-").concat(e);
      },
      i = !1,
      r = !1;
    window.openDrawio = function (n) {
      var a,
        c,
        s,
        d,
        l,
        u,
        f = n.element,
        v = n.svgContent,
        p = f.webAppUrl,
        g =
          void 0 === p ? "https://static.axhub.cn/drawio/webapp/index.html" : p,
        h =
          ("editortoken",
          (s = window.top.location.href),
          (d = new RegExp("(^|[&|?|#])editortoken=([^&]*)(&|$)", "i")),
          (null !=
          (u =
            null == (l = s || location.href) ? void 0 : l.substring(1).match(d))
            ? decodeURIComponent(u[2])
            : null) ||
            (function (e) {
              for (
                var t = o("token") + "=",
                  n = decodeURIComponent(document.cookie).split(";"),
                  i = 0;
                i < n.length;
                i++
              ) {
                for (var r = n[i]; " " === r.charAt(0); ) r = r.substring(1);
                if (0 === r.indexOf(t)) {
                  var a = r.substring(t.length, r.length);
                  try {
                    return JSON.parse(a);
                  } catch (e) {
                    return a;
                  }
                }
              }
              return "";
            })());
      if (h) {
        var m,
          w,
          y = "editortoken=".concat(h),
          b =
            null === (m = top) || void 0 === m
              ? void 0
              : m.location.href.replace(new RegExp(y), "");
        null === (w = top) ||
          void 0 === w ||
          w.history.pushState({}, document.title, b),
          (function (e, n, i) {
            var r = o("token");
            "object" === t(n) && (n = JSON.stringify(n));
            var a = new Date();
            a.setTime(a.getTime() + 1296e6),
              (document.cookie = ""
                .concat(r, "=")
                .concat(n, ";path=/;expires=")
                .concat(a.toUTCString()));
          })(0, h);
      }
      var S,
        I = (0, e.Z)(
          ""
            .concat(g, "?top=")
            .concat(encodeURIComponent(window.top.location.href))
            .concat(h ? "&editortoken=".concat(h) : "")
        );
      window.addEventListener("drawioLoaded", function () {
        S = document.querySelector("#drawio-iframe");
      }),
        window.addEventListener("message", function (e) {
          try {
            var t =
              "string" == typeof (null == e ? void 0 : e.data) &&
              null != e &&
              e.data
                ? JSON.parse(e.data)
                : null == e
                ? void 0
                : e.data;
            "loginStatusChange" === (null == t ? void 0 : t.action) &&
              (i = (null == t ? void 0 : t.isLogin) || !1),
              "init" === (null == t ? void 0 : t.event) && ((r = !0), I(v));
          } catch (t) {
            console.log(t, null == e ? void 0 : e.data);
          }
        }),
        window.addEventListener("drawioImageCreated", function (e) {
          if (i)
            try {
              var t = e.imageContent,
                n = e.imageType;
              window.onDrawioChange &&
                window.onDrawioChange({ type: n, content: t });
            } catch (e) {
              console.log(e);
            }
        }),
        (-1 !==
          (null === (a = window.location.host) || void 0 === a
            ? void 0
            : a.indexOf("127.0.0.1")) ||
          (null != f && f.isDev)) &&
          (window.top &&
            ((window.top.openNextPage = function () {}),
            (window.top.openPreviousPage = function () {})),
          null === (c = S) ||
            void 0 === c ||
            null === (c = c.contentWindow) ||
            void 0 === c ||
            c.postMessage(
              JSON.stringify({
                action: "saveParentLocation",
                value: window.top.location,
              }),
              "*"
            ),
          r && I(v));
    };
  })();
})();
